package com.minelx.woods.task.common;

import com.minelx.sqlstructures.core.database.IDatabase;

import java.util.Objects;

// FIXME 2021/12/27 needed test cover.
public class StructureDatabase {
	private final IDatabase database;

	private final String index;

	private final String name;

	public StructureDatabase(IDatabase database, String index, String name) {
		this.database = database;
		this.index = index;
		this.name = name;
	}

	public IDatabase getDatabase() {
		return database;
	}

	public String getIndex() {
		return index;
	}

	public String getName() {
		return name;
	}

	@Override
	public String toString() {
		return "StructureDatabase{" +
				"database=" + database +
				", index='" + index + '\'' +
				", name='" + name + '\'' +
				'}';
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		StructureDatabase that = (StructureDatabase) o;
		return database.equals(that.database) && index.equals(that.index) && name.equals(that.name);
	}

	@Override
	public int hashCode() {
		return Objects.hash(database, index, name);
	}
}
